package com.thiswhyme.fsplus.sentinel.feign.instancefilter;

import cn.hutool.json.JSONUtil;
import com.netflix.loadbalancer.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.ribbon.ZonePreferenceServerListFilter;

import java.util.List;

/**
 * @description: 自定义服务列表过滤器
 * 此处暂时用不到
 * @author: thiswhyme
 * @date: 2021/4/29
 */
public class CustomZonePreferenceServerListFilter extends ZonePreferenceServerListFilter {

    public static final Logger log = LoggerFactory.getLogger(CustomZonePreferenceServerListFilter.class);

    @Override
    public List<Server> getFilteredListOfServers(List<Server> servers) {
        //TODO 此处可自定义过滤从注册中心渠道的实例
        log.info("开始定时更新可用服务列表：{}", JSONUtil.toJsonStr(servers));
        return super.getFilteredListOfServers(servers);
    }
}
